
import 'package:example/r.dart';
import 'package:flutter/material.dart';
import 'package:fluttertenroadui/fluttertenroadui.dart';

class AboutPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return AboutPageState();
  }
  
}

class AboutPageState extends State<AboutPage> {
  Widget _headerView() {
    return Column(
      children: <Widget>[
        SizedBox(height: 60,),
        Image.asset(R.assetsImagesLogoTrans, scale: 3.4,),
        SizedBox(height: 10,),
        Text('TLUI', style: TextStyle(fontSize: 30, fontWeight: FontWeight.w500, letterSpacing: 6),),
        SizedBox(height: 45,),
        Text('version 0.0.1', style: TextStyle(fontSize: 16), textAlign: TextAlign.center,),
        SizedBox(height: 40,),
      ],
    ) ;
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    bool isDarkMode = Theme.of(context).brightness == Brightness.dark;
    final isRtl = Directionality.of(context) == TextDirection.rtl;
    return Scaffold(
      appBar: AppBar(
        title: Text('About', style: TextStyle(letterSpacing: 4),),
        centerTitle: true,
      ),
      body: Container(
        child: ListView.separated(itemBuilder: (BuildContext context, int index) {
          if(index == 0) {
            return _headerView();
          } else if (index == 1) {
            return TLListTile(
              title: Text('Dark Mode'),
              trailing: Switch(
                value: isDarkMode,
                onChanged: (value) {
                  setState(() {});
                },
              ),
            );
          } else if (index == 2) {
            return TLListTile(
              title: Text('Force RTL'),
              trailing: Switch(
                value: isRtl,
                onChanged: (value) {
                  setState(() {});
                },
              ),
            );
          } else if (index == 3) {
            return TLListTile(
              title: Text('Site'),
              trailing: Icon(isRtl
                  ? Icons.keyboard_arrow_left
                  : Icons.keyboard_arrow_right),
              onTap: () {
              },
            );
          } else if (index == 4) {
            return TLListTile(
              title: Text('GitHub'),
              trailing: Icon(isRtl
                  ? Icons.keyboard_arrow_left
                  : Icons.keyboard_arrow_right),
              onTap: () {
              },
            );
          }
          return null;
        }, separatorBuilder: (context, index) {
          return Divider(height: 1,);
        }, itemCount: 6),
      ),
    );
  }
  
}